package pers.cj.pdos.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pers.cj.pdos.entity.ArrearsWait;
import pers.cj.pdos.mapper.ArrearsWaitMapper;
import pers.cj.pdos.service.IArrearsWaitService;
import pers.cj.pdos.utils.Utils;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 等待的收款，客户欠的款 服务实现类
 * </p>
 *
 * @author chenj
 * @since 2020-03-05
 */
@Service
public class ArrearsWaitServiceImpl extends ServiceImpl<ArrearsWaitMapper, ArrearsWait> implements IArrearsWaitService {
    @Autowired
    ArrearsWaitMapper arrearsWaitMapper;

    @Override
    public List<Map> listVo(String companyId,
                            Integer page,
                            Integer limit,
                            String storeId,
                            String customTypeId,
                            Boolean notNeedIn,
                            Boolean customNoStop,
                            String search) {
        return arrearsWaitMapper.listVo(companyId, Utils.genPage(page,limit),limit,storeId,customTypeId,notNeedIn,customNoStop,search);
    }

    @Override
    public long count(String companyId,
                      String storeId,
                      String customTypeId,
                      Boolean notNeedIn,
                      Boolean customNoStop,
                      String search) {
        return arrearsWaitMapper.count(companyId, storeId,customTypeId,notNeedIn,customNoStop,search);
    }

    @Override
    public Map getMapByCustom(String customId) {
        return arrearsWaitMapper.getMapByCustom(customId);
    }

    @Override
    public List<Map> listDetail(String customId,
                                Integer page,
                                Integer limit,
                                Boolean close,
                                String search,
                                String no,
                                String remark,
                                String userId,
                                Date date1,
                                Date date2,
                                Integer flag,
                                String storeId) {
        return arrearsWaitMapper.listDetail(customId, Utils.genPage(page,limit), limit, close, search, no, remark, userId, date1, date2, flag, storeId);
    }

    @Override
    public long countDetail(String customId,
                            Boolean close,
                            String search,
                            String no,
                            String remark,
                            String userId,
                            Date date1,
                            Date date2,
                            Integer flag,
                            String storeId) {
        return arrearsWaitMapper.countDetail(customId,close, search, no, remark, userId, date1, date2, flag, storeId);
    }

    @Override
    public BigDecimal getTotalAmount(String companyId) {
        return arrearsWaitMapper.getTotalAmount(companyId);
    }
}
